package com.best.onegous.details;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import com.best.onegous.BaseActivity;
import com.best.onegous.R;
import com.best.onegous.View.PickerView;
import com.best.onegous.View.PickerView.onSelectListener;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class KouLing extends BaseActivity implements OnClickListener{
	private PickerView poptext;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setThem(R.layout.kouling_activity);
		findViewById(R.id.back).setOnClickListener(this);
		findViewById(R.id.xuanze).setOnClickListener(this);
	}
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.back:
			 finish();
			break;
		case R.id.xuanze:
			callOption();
			break;
		default:
			break;
		}
	}
	private void callOption() {

		LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View layout = layoutInflater.inflate(R.layout.xuanze_pop, null);
		poptext = (PickerView) layout.findViewById(R.id.poptext);
		List<String> data = new ArrayList<String>();
		for (int i = 0; i < 10; i++)
		{
			data.add("0" + i);
		}
		poptext.setData(data);
		poptext.setOnSelectListener(new onSelectListener()
		{

			@Override
			public void onSelect(String text)
			{
				/*Toast.makeText(MainActivity.this, "閫夋嫨浜� " + text + " 鍒�",
						Toast.LENGTH_SHORT).show();*/
			}
		});
		poptext.setSelected(0);
		final Dialog dialog = new Dialog(this);
		dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
		LayoutParams  layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);
		dialog.setContentView(layout,layoutParams);
		
		Window win = dialog.getWindow();
		win.getDecorView().setPadding(0, 0, 0, 0);
		WindowManager.LayoutParams lp = win.getAttributes();
		        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
		        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
		        lp.gravity=Gravity.BOTTOM;
		        lp.windowAnimations=R.style.dialogAnim;
		win.setAttributes(lp);
		
		
		dialog.show();

		/*TextView takePhoto = (TextView) layout.findViewById(R.id.takePhotoTv);
		TextView choosePhoto = (TextView) layout.findViewById(R.id.choosePhotoTv);
		TextView cancel = (TextView) layout.findViewById(R.id.cancelTv);
		takePhoto.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				dialog.dismiss();
				 
			}

		});
		choosePhoto.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				dialog.dismiss();
				
			}
		});
		cancel.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				dialog.dismiss();
			}
		});*/
	
	}
}
